//
// Created by Ivor_ on 2023/2/28.
//

#ifndef PHYSICAL_COMPUTING_PACKAGE_SPECIALFUNCTIONS_H
#define PHYSICAL_COMPUTING_PACKAGE_SPECIALFUNCTIONS_H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/**
 * @author Ivor
 * @param order the order of your require, non negative integer is accepted
 * @param variable the function variable
 * @return the function value(s) (or derivative value(s)) at the variable of the function of the specified(or all lower) order
 * @remark Legendre, Laguerre and Hermite functions are included, both function value(s) and derivative(s) are supported, for the function with array as its return value, it contains the zeroth order to the "order"th order(included), i.e. you will receive an array with (order+1) elements
 */
double legendreSF(int order, double variable);
double* legendresSF(int order, double variable);
double legendreDerivativeSF(int order, double variable);
double* legendreDerivativesSF(int order, double variable);
double laguerreSF(int order, double variable);
double* laguerresSF(int order, double variable);
double laguerreDerivativeSF(int order, double variable);
double* laguerreDerivativesSF(int order, double variable);
double hermiteSF(int order, double variable);
double* hermitesSF(int order, double variable);
double hermiteDerivativeSF(int order, double variable);
double* hermiteDerivativesSF(int order, double variable);

/**
 * @author Ivor
 * @remark packaged with function category, for example, "double* aa = sf("hermite").functions(2, 2.);".
 */
struct specialFunctionsCallCategory {
    double (*function)(int order, double variable);
    double* (*functions)(int order, double variable);
    double (*derivative)(int order, double variable);
    double* (*derivatives)(int order, double variable);
};

struct specialFunctionsCallCategory sf(const char* functionName);

#endif //PHYSICAL_COMPUTING_PACKAGE_SPECIALFUNCTIONS_H
